var app = getApp()
Page({
  data: {
    listData: [],
    text: "",
    data_url: "",
    a: 0,
  },
  jumpDetails: function (e) {
    wx.navigateTo({
      url: '/pages/details/details?id=' + e.currentTarget.dataset.id
    })
  },
  onLoad: function (options) {
    wx.showLoading({
      title: '加载中',
    })
    this.setData({
      data_url: app.globalData.data_url
    })
    this.setData({
      text: options.text
    })
    var that = this;
    if (options.HotSellingGoods) {
      wx.request({
        url: that.data.data_url + "/GPD/getHotSellingGoods.do",
        data: {
          page: 1,
          row: 999
        },
        success: function (res) {
          wx.hideLoading()
          that.setData({
            listData: res.data
          })
        }
      })
    } else if (options.newProduct) {
      wx.request({
        url: that.data.data_url + '/GPD/getnewProduct.do',
        data: {
          page:1,
          row:999
        },
        header: {
          'Content-Type': 'application/json'
        },
        success: function (res) {
          wx.hideLoading()
          that.setData({
            listData: res.data
          })
        }
      })
    } else {
      wx.request({
        url: that.data.data_url + '/GPD/getfindByTimeLimit.do',
        data: {
          page: 1,
          row: 999
        },
        success: function (res) {
          wx.hideLoading()
          that.setData({
            a: 1,
            listData: res.data
          })
        }
      })
    }
  },
  onReady: function () {

  },
  onShow: function () {

  },
  onHide: function () {

  },
  onUnload: function () {

  },
  onPullDownRefresh: function () {

  },
  onReachBottom: function () {

  }
})		